﻿using MediatR;
using S.Produce.Domains;
using S.Produce.Infrastructure;
using S.Produce.Read.Api.Application.Commands.PregnantCommands;
using System.Net.NetworkInformation;

namespace S.Produce.Read.Api.Application.CommandHandlers.PregnantCommandHandlers
{
    /// <summary>
    /// 
    /// </summary>
    public class PregnantBackfillCommandHandler : IRequestHandler<PregnantBackfillCommand, Pregnant>
    {
        private readonly IRepository<Pregnant> _repository;

        /// <summary>
        /// 构造方式注入
        /// </summary>
        /// <param name="repository"></param>
        public PregnantBackfillCommandHandler(IRepository<Pregnant> repository)
        {
            _repository = repository;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<Pregnant> Handle(PregnantBackfillCommand request, CancellationToken cancellationToken)
        {
            var info = await _repository.GetAsync(request.Id);
            return info;
        }
    }
}
